/**
 * Created by wingsfrog on 2017/6/1.
 */

import {Injectable} from '@angular/core';
import {HttpUtils} from "../utils/http.utils";
import {Observable} from "rxjs/Rx";
import {LocalStorage} from "../app.local-storage";
import {USER} from "./user.service";
import {ParamsModel} from "../model/params.model";

@Injectable()
export class IMAGEAPI {

  imageUploadApi:string='/oss/image';
  base64UploadApi:string='/oss/image/base64';
  constructor(private api:HttpUtils,
              private USER: USER) {
  }

  imageUpload(params:any,success:any){
    let pm = new ParamsModel(this.USER)
    pm.url = this.imageUploadApi;
    pm.reqestData = params;
    pm.succCallback = success;
    this.api.postFormData(pm);
  };
  base64Upload(params:any,success:any){
    let pm = new ParamsModel(this.USER)
    pm.url = this.base64UploadApi;
    pm.reqestData = params;
    pm.succCallback = success;
    this.api.post(pm);
  };

}
